package mx.com.mindbits.bandpay.adapters;

import mx.com.mindbits.bandpay.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

public class GridViewAdapter extends BaseAdapter{
	private Context context;
	//this come from a data base, we can change it
	private int images[] = {R.drawable.credit_card_ico, R.drawable.tae_ico, R.drawable.historial_ico};
	
	public GridViewAdapter(Context context){
		this.context = context;
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent){
		LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View gridView;
		if(convertView == null){
			gridView = new View (context);
			gridView = layoutInflater.inflate(R.layout.gridview_cell_content, null);			
			ImageView imageCell = (ImageView)gridView.findViewById(R.id.grid_item_image);
			imageCell.setImageResource(images[position]);			
		}else{
			gridView = (View) convertView;
		}
		return gridView;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return images.length;
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}
	

}
